package model

import (
	"torler.com/qingyue/common/types"
)

type ChapterInfo struct {
	Id          types.TableId `gorm:"column:id;primaryKey;autoIncrement"`                        //自增ID,主键,自动递增,创建时忽略
	BookId      types.TableId `gorm:"column:book_id;default:0;uniqueIndex:uidx_ci_bc"`           //小说ID
	ShowIndex   int           `gorm:"column:show_idx;type:int;default:0;uniqueIndex:uidx_ci_bc"` //章节显示顺序
	ChapterName string        `gorm:"column:chapter_name;type:varchar(50)"`                      //章节名称
	types.Basic
}

func NewChapterInfo(bookId types.TableId, showIndex int, name string) *ChapterInfo {
	return &ChapterInfo{
		BookId:      bookId,
		ShowIndex:   showIndex,
		ChapterName: name,
	}
}
func (ChapterInfo) TableName() string {
	return "sp_chapter"
}
